import BASE_URL from '@/utils/config'
export function uploadFiles(file) {
	uni.showLoading({
		title: '上传中...'
	})
	return new Promise((resolve, reject) => {
		uni.uploadFile({
			url: BASE_URL.fankongApp + "/file/upload",
			filePath: file,
			name: 'file',
			// formData: {
			// type: 'zaizhefeiapp'
			// },
			header: {
				'Authorization': uni.getStorageSync("fankongApp_key") || ""
			},
			success: uploadFileRes => {
				resolve(JSON.parse(uploadFileRes.data))
			},
			fail: e => {
				reject(e)
			},
			complete: () => {
				uni.hideLoading()
			}
		})
	})
}